package com.gaohe.scp.service.impl;

import java.util.ArrayList;
import java.util.List;
import com.gaohe.common.utils.DateUtils;
import com.gaohe.scp.domain.CsOrder;
import com.gaohe.scp.mapper.CsOrderMapper;
import com.gaohe.scp.domain.vo.CsOrderDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gaohe.scp.mapper.CsOrderDetailMapper;
import com.gaohe.scp.domain.CsOrderDetail;
import com.gaohe.scp.service.ICsOrderDetailService;

/**
 * 用户订单详情Service业务层处理
 *
 * @author liuxiangyu
 * @date 2025-03-25
 */
@Service
public class CsOrderDetailServiceImpl implements ICsOrderDetailService
{
    @Autowired
    private CsOrderDetailMapper csOrderDetailMapper;
    @Autowired
    private CsOrderMapper csOrderMapper;

    /**
     * 查询用户订单详情
     *
     * @param orderId 用户订单详情主键
     * @return 用户订单详情
     */
    @Override
    public CsOrderDetail selectCsOrderDetailByorderId(Long orderId)
    {
        return csOrderDetailMapper.selectCsOrderDetailByorderId(orderId);
//
    }

    /**
     * 查询用户订单详情列表
     *
     * @param csOrderDetail 用户订单详情
     * @return 用户订单详情
     */
    @Override
    public List<CsOrderDetail> selectCsOrderDetailList(CsOrderDetail csOrderDetail)
    {
        return csOrderDetailMapper.selectCsOrderDetailList(csOrderDetail);
    }
    /**
     * 根据id查询订单详细信息*/
    @Override
    public CsOrderDetailVo selectCsOrderDetailList1(Long orderId) {
        return csOrderDetailMapper.selectCsOrderDetailList1(orderId);
    }

    /**
     * 新增用户订单详情
     *
     * @param csOrderDetail 用户订单详情
     * @return 结果
     */
    @Override
    public int insertCsOrderDetail(CsOrderDetail csOrderDetail)
    {
        csOrderDetail.setCreateTime(DateUtils.getNowDate());
        return csOrderDetailMapper.insertCsOrderDetail(csOrderDetail);
    }

    /**
     * 修改用户订单详情
     *
     * @param csOrderDetail 用户订单详情
     * @return 结果
     */
    @Override
    public int updateCsOrderDetail(CsOrderDetail csOrderDetail)
    {
        csOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return csOrderDetailMapper.updateCsOrderDetail(csOrderDetail);
    }

    /**
     * 批量删除用户订单详情
     *
     * @param orderDetailIds 需要删除的用户订单详情主键
     * @return 结果
     */
    @Override
    public int deleteCsOrderDetailByOrderDetailIds(Long[] orderDetailIds)
    {
        return csOrderDetailMapper.deleteCsOrderDetailByOrderDetailIds(orderDetailIds);
    }

    /**
     * 删除用户订单详情信息
     *
     * @param orderDetailId 用户订单详情主键
     * @return 结果
     */
    @Override
    public int deleteCsOrderDetailByOrderDetailId(Long orderDetailId)
    {
        return csOrderDetailMapper.deleteCsOrderDetailByOrderDetailId(orderDetailId);
    }
}
